﻿Imports Microsoft.Xna.Framework
Imports Runa.Resources.ResourceManager
Imports System.Xml

Namespace Global.Runa.UI.Styles

    Public Class ButtonStyle
        Inherits Style

        Public Property ButtonTintColors As Color()
        Public Property Skin As Texture2DObject
        Public Property SkinButtonLeft As Rectangle
        Public Property SkinButtonMiddle As Rectangle
        Public Property SkinButtonRight As Rectangle

        Public Sub New(ByVal reader As XmlReader)
            MyBase.New(reader)
            Me.SkinButtonLeft = New Rectangle(0, 40, 10, &H16)
            Me.SkinButtonRight = New Rectangle(40, 40, 10, &H16)
            Me.SkinButtonMiddle = New Rectangle(10, 40, 30, &H16)
            Me.ButtonTintColors = New Color() {New Color(&HFF, &HFF, &HFF), New Color(240, 240, 250), New Color(&HFF, &HFF, &HFF), New Color(220, 220, 250)}
        End Sub

        Public Sub New(ByVal g As Game)
            Me.New("", g)
        End Sub

        Public Sub New(ByVal StyleName As String, ByVal g As Game)
            MyBase.New(StyleName, g)
            Me.SkinButtonLeft = New Rectangle(0, 40, 10, &H16)
            Me.SkinButtonRight = New Rectangle(40, 40, 10, &H16)
            Me.SkinButtonMiddle = New Rectangle(10, 40, 30, &H16)
            Me.ButtonTintColors = New Color() {New Color(&HFF, &HFF, &HFF), New Color(240, 240, 250), New Color(&HFF, &HFF, &HFF), New Color(220, 220, 250)}
        End Sub

        Protected Overrides Sub Load(ByVal xml As XmlReader)
            MyBase.Load(xml)
            Me.Skin = TryCast(MyBase.Item("NormalSkin"), Texture2DObject)
            Me.SkinButtonLeft = DirectCast(MyBase.Item("SkinButtonLeft"), Rectangle)
            Me.SkinButtonRight = DirectCast(MyBase.Item("SkinButtonRight"), Rectangle)
            Me.SkinButtonMiddle = DirectCast(MyBase.Item("SkinButtonMiddle"), Rectangle)
        End Sub

    End Class

End Namespace